/*
 * Iparelan Annotations Utilities
 * This file is part of Pattern Notes.
 * Copyright (c) 2008, Iparelan Solutions, LLC. All rights reserved.
 *
 * Pattern Notes is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Pattern Notes is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with Pattern Notes. If not, see <http://www.gnu.org/licenses/>.
 */

package com.iparelan.annotations.idioms;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import com.iparelan.annotations.Copyright;

/**
 * Marks a field that causes a partially constructed object to escape from a
 * constructor if the field is initialized in the constructor. This occurs
 * when a circular dependency exists between an object and a field.
 *
 * <p>Such a field should most likely be initialized in a static factory
 * method. All constructors should be made {@code private}.
 *
 * <p>Also, consider whether the field instance should refer to the enclosing
 * object with a {@code WeakReference} or a {@code SoftReference}.
 *
 * @see <nobr>"<a href="http://www.javaconcurrencyinpractice.com">Java Concurrency in Practice</a>," Goetz, section 3.2.1 "Safe construction practices"</nobr>
 * @see <nobr>"<a href="http://oreilly.com/catalog/9780596005689">Hardcore Java</a>," Simmons, Chapter 11, "A Weak Listener"</nobr>
 *
 * @author Greg Mattes
 * @version August 2008
 */
@Target(ElementType.FIELD)
@Retention(RetentionPolicy.SOURCE)
@Copyright("Copyright &copy; 2008, Iparelan Solutions, LLC. All rights reserved.")
public @interface InitializationAvoidsThisEscapeFromConstructor {
}
